package com.rover022.flixelgame.ui.equippackage
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;

	public class ItemBitMapMirror extends Sprite
	{
		public var bitmap:Bitmap;
		public var bitmapdata:BitmapData;

		public function ItemBitMapMirror(src:DisplayObject)
		{
			super();
			bitmapdata = new BitmapData(src.width, src.height);
			bitmapdata.draw(src);
			bitmap = new Bitmap(bitmapdata);
			addChild(bitmap);
			addEventListener(Event.REMOVED_FROM_STAGE, dispose);
		}

		public function dispose(event:Event):void
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, dispose);
			bitmapdata.dispose();
			bitmapdata = null;
			bitmap = null;
		}
		public function removeFromStage():void
		{
			if(parent){
				parent.removeChild(this);
			}
		}
	}
}
